<?php
$session=new CHttpSession();
$session->open();
$i=$session['i'];

$items=array(
    'director'=>array('v'=>isset($data->info->director) ? $data->info->director : 0, 'label'=>'理事成员','range'=>array('1'=>'是','0'=>'否')),
    'expert'=>array('v'=>isset($data->info->expert) ? $data->info->expert : 0, 'label'=>'专家成员','range'=>array('1'=>'是','0'=>'否')),
    'manager'=>array('v'=>isset($data->info->manager) ? $data->info->manager : 0, 'label'=>'管理团队','range'=>array('1'=>'是','0'=>'否')),
//    'audit'=>array('v'=>isset($data->info->audit) ? $data->info->audit : 0, 'label'=>'通过审核','range'=>array('0'=>'未审核', '1'=>'是','-1'=>'否')),

);

if(isset($data->superuser) && $data->superuser==1){
    //管理员
    $user_title='管理员';
}
elseif($data->p->type_pg==1 && in_array($data->p->type_p_vasn, array(1,2,3,4))){
    //个人会员
    if($data->p->type_p_vasn==1){
        //尊贵会员
        $user_title='尊最会员';

    }elseif($data->p->type_p_vasn==2) {
        //高级会员
        $user_title='高级会员';

    }elseif($data->p->type_p_vasn==3) {
        //普善会员
        $user_title='普善会员';

    }elseif($data->p->type_p_vasn==4) {
        //晋学会员
        $user_title='晋学会员';
    }
}
elseif($data->p->type_pg==2 && in_array($data->p->type_g_pebg, array(1,2,3,4))){
    //团体会员会员
    if($data->p->type_g_pebg==1){
        //公共机构
        $user_title='公共机构';

    }elseif($data->p->type_g_pebg==2) {
        //学校教育
        $user_title='学校教育';

    }elseif($data->p->type_g_pebg==3) {
        //公司企业
        $user_title='公司企业';

    }elseif($data->p->type_g_pebg==4) {
        //其他团体
        $user_title='其他团体';

    }
}
?>
<form method="post" action="/index.php?r=manage/upinfo">
<tr<?php echo $i%2==1 ? '': ' class="tr1"'; ?>>
    <td align="center" class="td1<?php echo $i%2==1 ? '': ' td2'; ?>">
        <a href="/index.php?r=users/index&id=<?php echo $data->id;?>">
            <?php echo $data->p->type_pg==1?'spcf':'';?><?php echo $data->username;?>
        </a>
    </td>
    <td align="center" class="ms td1<?php echo $i%2==1 ? '': ' td2'; ?>">
            <?php echo $data->p->type_pg==1?'spcf':'';?><?php echo $data->p->nickname;?>
    </td>
    <td align="center" class="ms td1<?php echo $i%2==1 ? '': ' td2'; ?>"><?php echo isset($user_title) ? $user_title : '';?></td>
    <?php foreach($items as $key=>$val): ?>
    <td class="ms td1<?php echo $i%2==1 ? '': ' td2'; ?>">
        <?php foreach($val['range'] as $r_key=>$r_val): ?>
        <input name="<?php echo $key;?>[<?php echo $data->id;?>]" type="radio" class="radio" value="<?php echo $r_key;?>" id="<?php echo $key;?>_<?php echo $data->id;?>_<?php echo $r_key;?>" <?php
            echo ($val['v']==$r_key) ? 'checked="checked"':''; ?> /><label for="<?php echo $key;?>_<?php echo $data->id;?>_<?php echo $r_key;?>"><?php echo $r_val;?></label>
        <?php endforeach;?>
    </td>
    <?php endforeach;?>
    <td align="center"<?php echo $i%2==1 ? '': ' class="td2"'; ?>>
        <input type="hidden" name="id" value="<?php echo $data->id;?>" />
        <input type="submit" value="更新" />|<input type="button" value="删除" onclick="if(confirm('删除后无法回复，确认删除此用户？')){window.location='/index.php?r=manage/deluser&id=<?php echo $data->id;?>';};" />
    </td>
</tr>
</form>
<?php
$session['i']=$i+1;
?>